//
//  ZDEmojiTool.swift
//  OCSinaWeiBo
//
//  Created by Apple on 15/11/8.
//  Copyright © 2015年 itcast. All rights reserved.
//

import Foundation

class ZDEmojiTool: NSObject {
    
    class func emoji(code: String) -> String {
        
        // 扫描器
        let scanner = NSScanner(string: code)
        
        // 存储扫描结果
        // UnsafeMutablePointer<UInt32>: UInt32类型的可变指针
        var value: UInt32 = 0
        
        scanner.scanHexInt(&value)
        
        //        print("扫描结果:\(value)")
        
        let c = Character(UnicodeScalar(value))
        
        let str = String(c)
        
        //        print("str:\(str)")
        
        return str
    }
}